//Basics 6
public class Name {
  /**
 * @uml.property  name="firstName"
 */
private String firstName;
  /**
 * @uml.property  name="middleName"
 */
private String middleName;
  /**
 * @uml.property  name="lastName"
 */
private String lastName;
  
  public Name(String fName, String lName) {
		firstName = fName;
		middleName = "";
		lastName = lName;
  }
  
  public Name(String fName, String mName, String lName) {
		firstName = fName;
		middleName = mName;
		lastName = lName;
}
  
  public Name (String fullName) {
	  int spacePos1 = fullName.indexOf(' ');
	  if(spacePos1==-1) {
		  firstName = fullName;
		  middleName = "";
		  lastName = "";
	  } else {
		  firstName = fullName.substring(0, spacePos1);
		  int spacePos2 = fullName.lastIndexOf(' ');
		  if (spacePos1 == spacePos2)
			  middleName = "";
		  else 
			  middleName = fullName.substring(spacePos1+1, spacePos2);
		  lastName = fullName.substring(spacePos2 + 1);  
	  }
  }
  
  /**
 * @return
 * @uml.property  name="firstName"
 */
public String getFirstName() {
	return firstName;
}
  /**
 * @return
 * @uml.property  name="middleName"
 */
public String getMiddleName() {
	return middleName;
}
  /**
 * @return
 * @uml.property  name="lastName"
 */
public String getLastName() {
	return lastName;
}
  
  /**
 * @param  fn
 * @uml.property  name="firstName"
 */
public void setFirstName(String fn) {
	firstName = fn;
}
  /**
 * @param  mn
 * @uml.property  name="middleName"
 */
public void setMiddleName(String mn) {
	middleName = mn;
}
  /**
 * @param  ln
 * @uml.property  name="lastName"
 */
public void setLastName(String ln) {
	lastName = ln;
}
  
  public String getFirstAndLastName() {
		return firstName + " " + lastName;
  }
  
  public String getLastCommaFirst() {
		return lastName + ", "+ firstName;
  }
  

  
  public String getFullName() {
	  String result = firstName + " ";
	  if (!middleName.equals("")) {
		  result += middleName + " ";
	  }
	  result += lastName;
	  return result;	  
  }



/**
 * @uml.property  name="customer"
 * @uml.associationEnd  inverse="name1:Customer"
 */
private Customer customer;

/**
 * Getter of the property <tt>customer</tt>
 * @return  Returns the customer.
 * @uml.property  name="customer"
 */
public Customer getCustomer() {
	return customer;
}

/**
 * Setter of the property <tt>customer</tt>
 * @param customer  The customer to set.
 * @uml.property  name="customer"
 */
public void setCustomer(Customer customer) {
	this.customer = customer;
}
  
  

}

